package myServlet;

import server.HttpProtocoUtil;
import servlet.HttpServlet;
import sevletpojo.Request;
import sevletpojo.Response;

import java.io.IOException;

/**
 * @author 王瑞
 * @description:
 * @date 2020/3/1  21:24
 */
public class MyServlet extends HttpServlet {

    @Override
    public void doPost(Request request, Response response) {
        String content = "<h1> doPost method </h1>";
        try {
            response.writeByOutPut(HttpProtocoUtil.getHttpHeader200(content.length())+content);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void doGet(Request request, Response response)  {

        String content = "<h1> doGet method </h1>";
        try {
            response.writeByOutPut(HttpProtocoUtil.getHttpHeader200(content.length())+content);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    @Override
    public void init() throws Exception {

    }

    @Override
    public void destrory() throws Exception {

    }
}
